package com.ruoyi.web.controller.galaxy;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.galaxy.service.IGalaxyOrderService;
import com.ruoyi.galaxy.vo.order.GalaxyApiOrderListResponse;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author yeoman
 * @date 2025/4/10 16:15
 * @description 银河票务订单
 */
@Controller
@RequestMapping("/galaxy/order")
public class GalaxyOrderController extends BaseController {

    private final String prefix = "galaxy/order";

    @Resource
    private IGalaxyOrderService galaxyOrderService;

    @RequiresPermissions("galaxy:order:view")
    @GetMapping()
    public String order()
    {
        return prefix + "/order";
    }

    @PostMapping("/list")
    @RequiresPermissions("galaxy:order:list")
    @ResponseBody
    public TableDataInfo list(Long userId) {
        startPage();
        GalaxyApiOrderListResponse response = galaxyOrderService.selectOrderList(userId);
        return getDataTable(response.getList(), response.getTotal());
    }

}
